PhoneGap Essentials: Building Cross-Platform Mobile Apps (Fernando Lopez-Lezcano's Library) by John M. Wargo
Author:John M. Wargo
Language: eng
Format: epub
Publisher: Addison-Wesley Professional
Published: 2012-10-17T04:00:00+00:00
Configuring Camera Options
Now that you know how to take pictures using the camera, let’s talk about options you can use to configure how the process works. As you may remember from the previous section, when calling getPicture, a developer can pass in a cameraOptions object that defines parameters controlling how the picture is obtained. The cameraOptions object supports the following properties:
• quality
• destinationType
• sourceType
• allowEdit
• encodingType
• targetWidth
• targetHeight
• mediaType
Each of these options will be described in greater detail in the following sections. Like with many other features of PhoneGap APIs, certain API options (such as allowEdit in the Camera API) apply on only a limited number of mobile platforms.
Here’s an example of a fully configured cameraOptions object you could use in one of your PhoneGap applications:
Click here to view code image
var cameraOptions = { quality : 75,
sourceType : Camera.PictureSourceType.CAMERA,
destinationType : Camera.DestinationType.FILE_URI,
allowEdit : true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 1024,
targetHeight: 768 };
When passed to the getPicture function, this cameraOptions object tells getPicture to get the picture from the camera (sourceType), return a file URI that points to the image file captured (destinationType), allow the user to edit the picture before returning it to the program (allowEdit), return the picture as a .jpeg file (encodingType), configure the encoded image file to use 75% image quality (quality), and set the image dimensions to 1024 by 768 pixels (targetWidth and targetHeight).
Now let’s describe each of the cameraOptions properties in greater detail.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12579)
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7697)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7098)
Microservices with Go by Alexander Shuiskov(6865)
Practical Design Patterns for Java Developers by Miroslav Wengner(6782)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6724)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6137)
The Art of Crafting User Stories by The Art of Crafting User Stories(5659)
NetSuite for Consultants - Second Edition by Peter Ries(5591)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5403)
Kotlin in Action by Dmitry Jemerov(5067)
